home *** CD-ROM | disk | FTP | other *** search
/ Macwelt 1 / Macwelt DVD 1.toast / Web-Publishing / HTML-Editoren / Alpha ƒ / Tcl / Modes / Matlab mode / matlabMode.tcl < prev    next >
Encoding:
Text File  |  2001-01-09  |  4.1 KB  |  134 lines

  1. ################################################################################
  2. #
  3. # Matlab package, version 2.0
  4. #
  5. # This is a set of TCL proc's that allow the shareware Macintosh text editor 
  6. # Alpha to act as a front end for MATLAB for Macintosh version 5.0 or 
  7. # higher.  Requires Alpha 7.0 or higher.  See file "Matlab Help" for more 
  8. # information.
  9. #
  10. ################################################################################
  11.  
  12. alpha::mode MATL 2.0.4 dummyMATL {*.m *.M} {
  13.     MATLMenu electricTab electricSemicolon
  14. } {
  15.     alpha::package require AlphaTcl 7.2.2fc1
  16.     addMenu MATLMenu "•405" MATL
  17.     set unixMode(matlab) MATL
  18.     newPref sig matlabSig {MATL}
  19. } maintainer {
  20.     "Stephen M. Merkowitz" Stephen.Merkowitz@lnf.infn.it
  21. } uninstall this-directory help {
  22.     file "Matlab Help"
  23. }
  24.  
  25.  
  26. #################################################################################
  27. # Autoload procedures
  28. ################################################################################
  29.  
  30. proc dummyMATL {} {}
  31. proc MATLMenu  {} {}
  32.  
  33.  
  34. #################################################################################
  35. # Hooks
  36. ################################################################################
  37.  
  38. namespace eval MATL {}
  39. hook::register saveHook MATL::saveHook MATL
  40.  
  41. ################################################################################
  42. # Flags and variables
  43. ################################################################################
  44.  
  45. newPref v prefixString     {% }     MATL
  46. newPref v wordBreak        {[_\w]+} MATL
  47. newPref v wordBreakPreface {[^_\w]} MATL
  48. newPref f wordWrap         {0}      MATL
  49.  
  50. newPref v tabSize  {3} MATL
  51. newPref v funcExpr {^[ \t]*(function|FUNCTION).*\(.*$} MATL
  52.  
  53. newPref f elecReturn   1 MATL
  54. # remove obsolete
  55. catch {unset MATLmodeVars(electricSemi)}
  56.  
  57. newPref f DblClickEdits  0 MATL
  58. newPref f clearOnSave    0 MATL
  59. newPref f webHelp        0 MATL
  60.  
  61. newPref v CmdWinName     {*Matlab Commands*} MATL
  62. newPref v CmdHistWinName {*Command History*} MATL
  63.  
  64. newPref v MatlabHelpFolder "" MATL
  65.  
  66. newPref f queEventsQuietly  0 MATL
  67.  
  68.  
  69. set commentCharacters(MATL:General) "% "
  70. set commentCharacters(MATL:Paragraph) [list "% " "% " "% "]
  71. set commentCharacters(MATL:Box) [list "%" 1 "%" 1 "%" 3]
  72.  
  73.  
  74. ################################################################################
  75. # Colorization
  76. ################################################################################
  77.  
  78. newPref color keywordColor      blue    MATL
  79. newPref color keyVariablesColor green   MATL
  80. newPref color punctuationColor  magenta MATL
  81.  
  82. set matKeywords { 
  83.     break else elseif end for if return while function switch case otherwise
  84.     global eval feval nargchk pause menu keyboard input ...
  85. }
  86.  
  87. set matKeyVariables { 
  88.     ans computer eps flops inf NaN pi realmax realmin 
  89.     nargin nargout varargout varargin
  90. }
  91.  
  92. regModeKeywords -e {%} -c red -k $MATLmodeVars(keywordColor) MATL $matKeywords  \
  93.     -i {[} -i {]} -i {(} -i {)} -i {,} -i {;} -I $MATLmodeVars(punctuationColor)
  94.  
  95. regModeKeywords -a -k $MATLmodeVars(keyVariablesColor) MATL $matKeyVariables
  96.  
  97. unset matKeywords
  98. unset matKeyVariables
  99.  
  100.  
  101. ################################################################################
  102. #  global variables
  103. ################################################################################
  104.  
  105. set commandHistory [list]
  106. set commandNum 0
  107. set lastMatlabResult ""
  108. set matlabBusy 0
  109. set MATLeventQue [list]
  110.  
  111.  
  112. ################################################################################
  113. #  Bind some keys
  114. ################################################################################
  115.  
  116. Bind '\r' <z>  matlabDoLine              "MATL"
  117. Bind up        matlabUp                  "MATL"
  118. Bind down      matlabDown                "MATL"
  119. Bind 'u'  <z>  matlabCancelLine          "MATL"
  120. Bind '\;' <o>  MATL::electricSemiJump    "MATL"
  121. Bind '\r'      bind::MATLcarriageReturn  "MATL"
  122.  
  123.  
  124. ################################################################################
  125. #  Load the rest of the matlab package
  126. ################################################################################
  127.  
  128. foreach f {Comm Engine Macros Menu Windows Doc HTML Completions} {
  129.      if [catch [set f "matlab${f}.tcl"]] {
  130.           alertnote "Loading of $f failed!"
  131.      }
  132. }
  133. unset f
  134.